major: build islands + scan routeDir without importing user code#3122
Merged
Conversation
This fixes a bunch of long standing issues in our tracker where a build wouldn't finish because of importing user code. It's common for backend apps to spawn some open ended tasks like subscribing to Deno KV or other things. This addresses another problem of having to set up ENV vars just for the build, even though they are technically not required to build islands. This also gives a roughly ~30% performance boost on cold starts.
e612bdb to
de6fbd2
Compare
csvn
reviewed
Jul 23, 2025
Contributor
There was a problem hiding this comment.
Sorry for my unsolicited feedback here on this in-progress PR, but was excited given the interesting and breaking changes. Even if I have vague misgivings about the entrypoint, this PR looks really awesome and promising and well worth the breaking changes! 🎉
Contributor
|
Shall I close #2874? |
This was referenced Aug 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a bunch of long standing issues in our tracker where a build wouldn't finish because of importing user code. It's common for backend apps to spawn some open ended tasks like subscribing to Deno KV or other things. This addresses another problem of having to set up ENV vars just for the build, even though they are technically not required to build islands.
This also gives a roughly ~30% performance boost on cold starts (at least on
deno.com). Unfortunately, this does require some breaking changes. But I believe the performance improvements + removing the footgun of loading user code during build is well worth it. This work is also a precursor in case we want to exploring moving to vite at some point in the future.Breaking changes
// main.ts const app = new App() .use(staticFiles()) - await fsRoutes(app, { - loadIsland: (path) => import(`./islands/${path}`), - loadRoute: (path) => import(`./routes/${path}`), - }); + app.fsRoutes()You can optionally change the
islandDirorrouteDirby passing that to theBuilder:applazily indev.ts. Passingapptobuilder.build()is not necessary anymore.deno serve// deno.json { "tasks": { "dev": "deno run -A --watch=static/,routes/ dev.ts", "dev": "deno run -A dev.ts build", - "start": "deno run -A main.ts", + "start": "deno serve -A _fresh/server.js", } }Remove this bit in
main.ts:Fixes #2240
Fixes #2640
Fixes #2592
Fixes #1843